<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopOrganizationManageUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_organization_manage_users', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('manageId')->default(0)->comment('organization_manage表id');
            $table->unsignedInteger('userId')->default(0)->comment('用户id');
            $table->string('name', 32)->default('')->comment('用户名称');
            $table->unsignedTinyInteger('type')->default(0)->comment('职位类型 6省区开发');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->unsignedTinyInteger('isDeleted')->default(0)->comment('');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '开店 - 组织管理-用户mappings';

            $table->index('manageId', 'idx_manageId');
            $table->index(['userId', 'type'], 'idx_userType');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_organization_manage_users');
    }
}
